package com.pinxixi.template.mapper;

import com.pinxixi.framework.domain.specification.Specification;
import com.pinxixi.framework.domain.specification.SpecificationOption;
import com.pinxixi.framework.domain.specification.ext.SpecificationEntity;
import com.pinxixi.framework.domain.specification.ext.SpecificationExt;
import com.pinxixi.framework.domain.template.Template;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface TemplateMapper {

    @Select("select id,name,brand_ids brandIds,spec_ids specIds,custom_attribute_items customAttributeItems from tb_type_template")
    List<Template> findAll();

    @Insert("insert into tb_type_template set name=#{name},brand_ids=#{brandIds},spec_ids=#{specIds},custom_attribute_items=#{customAttributeItems}")
    void add(Template template);

    @Select("select id,name,brand_ids brandIds,spec_ids specIds,custom_attribute_items customAttributeItems from tb_type_template where id=#{id}")
    Template findOne(Integer id);

    @Update("update tb_type_template set name=#{name},brand_ids=#{brandIds},spec_ids=#{specIds},custom_attribute_items=#{customAttributeItems} where id=#{id}")
    void update(Template template);

    @Delete("delete from tb_type_template where id=#{id}")
    void delete(Integer id);

    List findPage(Map map);

    Integer findCount(Template template);

    void deleteAll(Integer[] ids);
}
